<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
    <!-- 百度禁止转码 -->
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!-- uc强制竖屏 -->
    <meta name="screen-orientation" content="portrait" />
    <!-- QQ强制竖屏 -->
    <meta name="x5-orientation" content="portrai" />
    <!-- 禁用电话号码邮箱自动识别 -->
    <meta name="format-detection" content="telephone=no,email=no" />
    <title>document</title>
  </head>

  <body>
    <button id="btn">切换action</button>
    <form id="form">
      <div>
        文本框
        <input type="text" name="" id="text" />
      </div>
      <div>
        数字框
        <input type="number" name="" id="number" />
      </div>
      <div>
        电话框
        <input type="tel" name="" id="tel" />
      </div>
      <div>
        搜索框
        <input type="search" id="search" />
      </div>
      <div>
        url框
        <input type="url" name="" id="url" />
      </div>
      <div>
        时间
        <input type="datetime" name="" id="datetime" />
      </div>
      <div>
        本地时间
        <input type="datetime-local" name="" id="datetime-local" />
      </div>
    </form>
    <script>
      var form = document.getElementById('form')
      var btn = document.getElementById('btn')
      btn.addEventListener('click', function() {
        if (form.action) {
          form.removeAttribute('action')
          return
        }
        form.action = ''
      })
    </script>
  </body>
</html>
